<?php
$ssFilter = $this->arrParam['ssFilter'];
		$lang = $ssFilter['lang'];
		if($lang == ''){
			$lang = 'vi';
		}else{
			$lang = $ssFilter['lang'];
		}
		
echo $this->blkBreadcumb(array(
			'Trang chủ'=> array(
					'module'	=>'default',
					'controller'=>'index',
					'action'	=>'index',
					'router'	=> 'home',
					'params'	=> array(
									'lang'=>$lang
								)
				),
			'Giỏ Hàng'=> array(
					'module'	=>'products',
					'controller'=>'index',
					'action'	=>'view-cart',
					'router'	=>'viewcart',
					'params'	=> array(
									'lang'=>$lang
								)
				),
			
		));
?>
<div class="clear"></div>
<!-- CONTENT (start) -->
<div class="detail">
 <div class="box width-100 mar-bottom-20">
 <div class="cnt-box">
 <form name="appform" id="appform" method="POST">
<?php if(!empty($this->Items)):
		$lang = $ssFilter['lang'];
			if($lang == ''){
				$lang = 'vi';
			}else{
				$lang = $ssFilter['lang'];
			}
			
		$info = new Zendvn_System_Info();
		$memberInfo = $info->getMemberInfo('id');
		if($memberInfo != ''){
		$tbltUser 				= new Zendvn_Models_Users();
		$user 					= $tbltUser->getItem(array('id'=>$memberInfo),array('task'=>'public'));
		$username = $user['first_name'] . " " . $user['last_name'];
	}
			?>
                        
                             
                                   <!--------- Noi dung--------->
                                    <div class="box-cnt width-100">
                                        <!--------- Tieu de bai viet--------->
                                        <div class="title width-100">
                                            <h2><a href="#" title="Giỏ hàng">Giỏ hàng</a></h2>
                                        </div>
                                        <!--------- Tieu de bai viet(end)--------->
                                        <div class="clear"></div>
                                        <div class="line-white"></div>
                                        <!--------- Table gio hang--------->
                                            <!--------------Phần tên khách hàng------------>
                                          <?php if(!empty($username)):?>
                            <div class="info">
                           
                                <div class="info-left float-left"><?php echo $username?></div>
                                <div class="info-right float-right">
                                    <span class="star">&nbsp;</span>
                                    <span class="star">&nbsp;</span>
                                    <span class="star">&nbsp;</span>
                                </div>
                            </div>
                             <?php endif;?>
                                            <!--------------Phần tên khách hàng------------>

                                        <table class="table-cart width-100" cellpadding="0" cellspacing="0" border="1px">
                                        	<thead>
                                            	<tr>
                                                	<td class="width-40">Món ăn</td>
                                                    <td class="width-15">Giá (VND)</td>
                                                    <td class="width-15">Số lượng</td>
                                                    <td class="width-15">Tổng</td>
                                                    <td class="width-15">Loại bỏ</td>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <?php
                                            $linksContinue =  array(
                                            							'module'=>'default',
																		'controller'=>'index',
																		'action'=>'index',
                                            							'lang'  => $lang,
										                   			);
												
										    $linksContinue = $this->url($linksContinue, 'home');
										    
                                            $linksOrder =  array(
                                            							'module'=>'products',
																		'controller'=>'index',
																		'action'=>'order',
                                            							'lang'  => $lang,
										                   			);
												
										    $linksOrder = $this->url($linksOrder, 'order');
										    
										    
                                            $items = $this->Items;
				                            $tblProduct = new Zendvn_Models_Products();
											$sumPrice = 0;
											$sumSellof= 0;
											foreach ($items as $key => $value):
										
												$arrtmp = explode("-", $key);
												$item = $tblProduct->getItem(array("id"=> $arrtmp[1]),array("task"=>"public-get"));
												
												$cutTring 	= new Zendvn_File_CutTring();
												$title 		= $item['name'];
												$title 		= str_replace("\\"," ",$title);
												$alt		= $item['name'];
												if(!empty($item['alt_seo'])) $alt = $item['alt_seo'];
												$alt 		= str_replace("\\"," ",$alt);
																	
												$summary 	= $item['summary'];
										        $summary 	= str_replace("\\"," ",$summary);
												$summary 	= $cutTring->cutTring(100,$summary,null);
												
												if(!empty($item['picture'])){
												    $linkImg	= FILES_URL . '/products/images450x450/' . $item['picture'];
												    $picture 	= '<img title="'. $title .'" src="'. $linkImg .'"  alt="'.$alt.'" />';
												}else{
												    $linkImg	= $this->imgUrl . '/no-image.jpg';
												    $picture 	= '<img title="'. $title .'" src="'. $linkImg .'"  alt="'.$alt.'" />';
												}
												$urlOptions = array('module'=>'products','controller'=>'index',
																	'action'=>'detail',
																	'title'=>$item['alias'],
																	'id'=>$item['id'],
										                   			'lang'=>$lang);
												$price = number_format($item["price"],0);
												$sumSellof += $items[$key]*$item["price"]-$items[$key]*$item["selloff"];
												$sumPrice  += $items[$key]*$item["price"];
												
										        $linkDetail = $this->url($urlOptions,'products-detail');
										        
										        $urlRemoveCart = array('module'=>'default',
																		'controller'=>'index',
																		'action'=>'ajax-remove-from-cart',
																		'id'=>$item['id'],
										                   			);
												
										        $linkRemoveCart = $this->url($urlRemoveCart, 'default',true);
												
				                            ?>    
                                                
                                                <tr>
                                                	<td>
                                                            <!--------- Tieu de bai viet--------->
                                                          <div class="title width-100">
                                                              <h2><a href="<?php echo $linkDetail?>" title="Gỏi mực Phú Quý"><?php echo $title?></a></h2>
                                                          </div>
                                                          <!--------- Tieu de bai viet(end)--------->
                                                          <!--------- Hinh anh - Tom tat--------->
                                                          <div class="bor-img width-55 float-left">
                                                              <a href="<?php echo $linkDetail?>"><?php echo $picture?></a>
                                                          </div>
                                                          <div class="desc summary width-40 float-right">
                                                              <p><?php echo $summary?></p>
                                                          </div>
                                                          <!--------- Hinh anh - Tom tat(end)--------->
                                                    </td>
                                                    <td><?php echo $price?> VNĐ</td>
                                                    <td> <div class="add-cart">
                                                                <input type="text" size="1" value="<?php echo $items[$key]?>" name="<?php echo $key;?>">
                                                        
                                                    </td>
                                                    <td><?php echo number_format($items[$key]*$item["price"],0)?> VNĐ</td>
                                                    <td>
                                                        <a href="<?php echo $linkRemoveCart.'/type/redirect';?>" title="Delete"><img src="<?php echo $this->imgUrl?>/icon/icon-delete.png" alt="Xóa bỏ" title="Xóa bỏ"> </a>
                                                    </td>
                                                </tr>
											<?php endforeach;?>
                                            </tbody>
                                        </table>

                                        <div class="info mar-top-20">
                                             <div class="info-left float-left">Tổng :  </div>
                                             <div class="info-right float-right"><?php echo number_format($sumPrice,0);?> VNĐ</div>
                                        </div>
                                        <div class="info">
                                            <div class="info-left float-left">Khuyến mãi : </div>
                                            <div class="info-right float-right">- <?php echo number_format($sumSellof,0);?> VNĐ</div>
                                        </div>
                                        <div class="info">
                                            <div class="info-left float-left">Tổng cộng : </div>
                                            <div class="info-right float-right"><?php echo number_format($sumPrice-$sumSellof,0);?> VNĐ</div>
                                        </div>
                                        <div class="info width-100 mar-top-20">
                                            <div class="info-left float-left">
                                                <a href="<?php echo $linksContinue?>" title="reset" class="bg-brown">Tiếp tục mua hàng</a>
                                            </div>

                                            <div class="info-right float-right">
                                                <a href="<?php echo $linksOrder?>" title="pay" class="bg-brown">Thanh toán đơn hàng</a>
                                            </div>
                                            <div class="info-left float-right mar-right-40">
                                                <a onclick="summitForm('#appform','<?php echo $this->url()?>')" title="Cập nhật" class="bg-brown">Cập nhật</a>
                                            </div>
                                        </div>

                                        <!--------- Table gio hang(end)--------->

                                  </div>
                                   <!---------Noi dung(end)-------->
                             
                         
                         <?php else: ?>
                         <p>Bạn chưa có sản phẩm nào trong giỏ hàng!</p>
                         <?php endif; // end if?>
                         </form>
                         </div>
                         </div><!-- box width-100 mar-bottom-20 -->
                    </div><!-- end DETAIL -->